import pygame
import spyral
import Dic

class Instruction(spyral.sprite.Sprite):
    def __init__(self, image):
        spyral.sprite.Sprite.__init__(self)
        
        self.image = pygame.image.load(image)
        self.image = self.image.convert()
        self.rect.center = (Dic.geom['width'] / 2,
                            Dic.geom['height'] / 2)
        self.layer = 2;
        self.alpha = 0;
        self.image.set_alpha(self.alpha)
        self.up = True;
        self.done = False;

    def update(self, tick):
        if (self.up == True):
            self.alpha += 30;
            if (255 < self.alpha):
                self.up = False;
                self.alpha = 255;
        if (0 < self.alpha):
            self.alpha -= 20;
        else:
            self.done = True;
        
        self.image = self.image.copy()
        self.image.set_alpha(self.alpha)
        
        
    def checkDone(self):
        return self.done;
    
    